roundedbox: Only grow border-radius if there is one
authorBenjamin Otte <otte@redhat.com>
Wed, 20 Aug 2014 22:10:43 +0000 (00:10 +0200)
committerBenjamin Otte <otte@redhat.com>
Wed, 20 Aug 2014 22:54:07 +0000 (00:54 +0200)
This is relevant for shadow spread and goes in line with the web.

Testcase included.

gtk/gtkroundedbox.c
testsuite/reftests/Makefile.am
testsuite/reftests/box-shadow-spread.css [new file with mode: 0644]
testsuite/reftests/box-shadow-spread.ref.ui [new file with mode: 0644]
testsuite/reftests/box-shadow-spread.ui [new file with mode: 0644]

index c3e2650e4cb85e2c7411f405c7b3025500eb171d..c89a1fd3543259ca0dc4673cc4ccf5a093cdaca4 100644 (file)
@@ -149,8 +149,10 @@ gtk_css_border_radius_grow (GtkRoundedBoxCorner *corner,
                             double               horizontal,
                             double               vertical)
 {
-  corner->horizontal += horizontal;
-  corner->vertical += vertical;
+  if (corner->horizontal)
+    corner->horizontal += horizontal;
+  if (corner->vertical)
+    corner->vertical += vertical;
 
   if (corner->horizontal <= 0 || corner->vertical <= 0)
     {
index 0b39b41dfdb26b44d1e94b45f86ab1aa9178925a..103b523fdec1dc070b0ecf477bb4ef9840cf9c3c 100644 (file)
@@ -143,6 +143,9 @@ testdata = \
        box-shadow-spec-inset.css \
        box-shadow-spec-inset.ref.ui \
        box-shadow-spec-inset.ui \
+       box-shadow-spread.css \
+       box-shadow-spread.ref.ui \
+       box-shadow-spread.ui \
        button-wrapping.ui \
        button-wrapping.ref.ui \
        cellrenderer-pixbuf-stock-rtl.css \
diff --git a/testsuite/reftests/box-shadow-spread.css b/testsuite/reftests/box-shadow-spread.css
new file mode 100644 (file)
index 0000000..b22bad4
--- /dev/null
@@ -0,0 +1,9 @@
+@import "reset-to-defaults.css";
+
+.test {
+  box-shadow: 0 0 0 10px red;
+}
+
+.reference {
+  border: solid 10px red;
+}
diff --git a/testsuite/reftests/box-shadow-spread.ref.ui b/testsuite/reftests/box-shadow-spread.ref.ui
new file mode 100644 (file)
index 0000000..f6894c2
--- /dev/null
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Generated with glade 3.18.1 -->
+<interface>
+  <requires lib="gtk+" version="3.12"/>
+  <object class="GtkWindow" id="window1">
+    <property name="width_request">100</property>
+    <property name="height_request">100</property>
+    <property name="can_focus">False</property>
+    <property name="type">popup</property>
+    <child>
+      <object class="GtkButton" id="button1">
+        <property name="label" translatable="yes">Hi</property>
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="receives_default">False</property>
+        <property name="halign">center</property>
+        <property name="valign">center</property>
+        <style>
+          <class name="reference"/>
+        </style>
+      </object>
+    </child>
+  </object>
+</interface>
diff --git a/testsuite/reftests/box-shadow-spread.ui b/testsuite/reftests/box-shadow-spread.ui
new file mode 100644 (file)
index 0000000..ef4cdea
--- /dev/null
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Generated with glade 3.18.1 -->
+<interface>
+  <requires lib="gtk+" version="3.12"/>
+  <object class="GtkWindow" id="window1">
+    <property name="width_request">100</property>
+    <property name="height_request">100</property>
+    <property name="can_focus">False</property>
+    <property name="type">popup</property>
+    <child>
+      <object class="GtkButton" id="button1">
+        <property name="label" translatable="yes">Hi</property>
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="receives_default">False</property>
+        <property name="halign">center</property>
+        <property name="valign">center</property>
+        <style>
+          <class name="test"/>
+        </style>
+      </object>
+    </child>
+  </object>
+</interface>